// eslint-disable-next-line import/no-duplicates
import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layout'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: 'home'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login')
  },
  {
    path: '/home',
    component: Layout,
    children: [
      {
        path: '',
        name: 'home',
        component: () => import('@/views/Home')
      }
    ]
  },
  // 工单管理
  {
    path: '/gd',
    component: Layout,
    children: [{
      path: '',
      name: 'gd',
      component: () => import('@/views/GD'),
      children: [
        {
          path: 'business',
          name: 'business',
          component: () => import('@/views/GD/business'),
          meta: {
            rightBtn: true,
            title: '工单编号',
            titleTwo: '工单状态',
            table: {
              name: '工单编号',
              one: '设备编号',
              two: '工单类型',
              three: '工单方式',
              four: '工单状态',
              five: '运营人员',
              six: '创建日期',
              btn: 1
            }
          }
        },
        {
          path: 'operation',
          name: 'operation',
          component: () => import('@/views/GD/operation')
        }
      ]
    }]
  },
  {
    path: '/dw',
    component: Layout,
    children: [{
      path: '',
      name: 'dw',
      component: () => import('@/views/DW'),
      children: [
        {
          path: 'region',
          name: 'region',
          component: () => import('@/views/DW/region'),
          meta: {
            title: '区域搜索',
            rightBtn: false,
            table: {
              name: '区域名称',
              one: '点位数',
              two: '备注说明',
              btn: 3
            }
          }
        },
        {
          path: 'node',
          name: 'node',
          component: () => import('@/views/DW/node'),
          meta: {
            rightBtn: false,
            title: '点位搜索',
            titleTwo: '区域搜索',
            table: {
              name: '点位名称',
              one: '所在区域',
              two: '商圈类型',
              four: '合作商',
              five: '详细地址',
              btn: 3
            }
          }
        },
        {
          path: 'partner',
          name: 'partner',
          component: () => import('@/views/DW/partner'),
          meta: {
            rightBtn: false,
            title: '合作商搜索',
            table: {
              name: '合作商名称',
              one: '账号',
              two: '设备数量',
              three: '分成比例',
              four: '联系人',
              five: '联系电话',
              toggle: false,
              btn: 4
            }
          }
        }
      ]
    }]
  },
  {
    path: '/sb',
    component: Layout,
    children: [{
      path: '',
      name: 'sb',
      component: () => import('@/views/SB'),
      children: [
        {
          path: 'equipment',
          name: 'equipment',
          component: () => import('@/views/SB/equipment')
        },
        {
          path: 'status',
          name: 'status',
          component: () => import('@/views/SB/status')
        },
        {
          path: 'type',
          name: 'type',
          component: () => import('@/views/SB/type')
        }
      ]
    }]
  },
  {
    path: '/ry',
    component: Layout,
    children: [{
      path: '',
      name: 'ry',
      component: () => import('@/views/RY'),
      children: [
        {
          path: 'personnel',
          name: 'personnel',
          component: () => import('@/views/RY/personnel')
        },
        {
          path: 'user-task-stats',
          name: 'user-task-stats',
          component: () => import('@/views/RY/user-task-stats')
        },
        {
          path: 'user-work',
          name: 'user-work',
          component: () => import('@/views/RY/user-work')
        }
      ]
    }]
  },
  {
    path: '/sp',
    component: Layout,
    children: [{
      path: '',
      name: 'sp',
      component: () => import('@/views/SP'),
      children: [
        {
          path: 'sku-class',
          name: 'sku-class',
          component: () => import('@/views/SP/sku-class')
        },
        {
          path: 'sku',
          name: 'sku',
          component: () => import('@/views/SP/sku')
        }
      ]
    }]
  },
  {
    path: '/cl',
    component: Layout,
    children: [
      {
        path: '',
        name: 'CL',
        component: () => import('@/views/CL')
      }
    ]
  },
  {
    path: '/dd',
    component: Layout,
    children: [
      {
        path: '',
        name: 'DD',
        component: () => import('@/views/DD')
      }
    ]
  },
  {
    path: '/dz',
    component: Layout,
    children: [
      {
        path: '',
        name: 'DZ',
        component: () => import('@/views/DZ')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
